package work.shyk.kongMonitor.dto.result;

import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import work.shyk.kongMonitor.dto.result.interfaces.ValueReceiver;

/**
 * description: <br>
 * createTime: 2020/2/1118:55 <br>
 *
 * @author zzh
 */
@Data
@AllArgsConstructor
@NoArgsConstructor
public class EsDataResult4Service extends EsDataResult implements ValueReceiver {
     int http2xx;

     int http3xx;

     int http4xx;

     int http5xx;

     int otherCode;

     long inflow;

     long outflow;


    public EsDataResult4Service(String tenantId, String serviceCode, Integer maxTimeDelay, Integer minTimeDelay, Integer averageTimeDelay, Integer sumTimeDelay, Integer accessCount, int http2xx, int http3xx, int http4xx, int http5xx, int otherCode, long inflow, long outflow) {
        super(tenantId, serviceCode, maxTimeDelay, minTimeDelay, averageTimeDelay, sumTimeDelay, accessCount);
        this.http2xx = http2xx;
        this.http3xx = http3xx;
        this.http4xx = http4xx;
        this.http5xx = http5xx;
        this.otherCode = otherCode;
        this.inflow = inflow;
        this.outflow = outflow;
        updateAccessCount();
    }

    public void updateAccessCount() {
        this.accessCount = this.http2xx + this.http3xx + this.http4xx + http5xx + this.otherCode;
    }

}
